home *** CD-ROM | disk | FTP | other *** search
- Path: newsstand.tc.umn.edu!usenet
- From: breid001@maroon.tc.umn.edu (Don Breidenbach)
- Newsgroups: comp.lang.c++
- Subject: Re: The philosophy of file I/O.
- Date: Sat, 23 Mar 1996 08:25:00 GMT
- Organization: University of Minnesota
- Message-ID: <4j05g2$c7c@epx.cis.umn.edu>
- References: <1996Mar19.155703.26730@alw.nih.gov>
- NNTP-Posting-Host: dialup-12-a-8.gw.umn.edu
- X-Newsreader: Forte Free Agent 1.0.82
-
- systex@BALROG.NCI.NIH.GOV (Donald G. Plugge, Systex Inc.,
- (301)931-0500) wrote:
-
-
- >As a new convert to the C++ language, I'd like my practical application coding
- >to not only work, but to match the philosophy of object oriented guidelines.
- >I'd like to get input from the C++ community on designing an actual solution.
- >The goal of my small application is to read a particular type of file format
- >and perform calculations on the data. I've been reading numerous books on the
- >subject of both C++ and object oriented programming, however, I'm keeping two
- >in mind while attacking this problem -- An Introduction To Object-Oriented
- >Programming by Timothy Budd and C++ IOStreams Handbook by Steve Teale. The
- >first book deals with the general concepts and the second deals with IO
- >specifically.
-
- >The format of the files to be read are comprised of three sections as follows:
-
- >1) A fixed format section containing an identifier and two sets of pointers.
- >This section is of a fixed length. The first set of pointers are byte offsets
- >into the second section. The second set of pointers are byte offsets into the
- >third section.
-
- >2) Text area which describes the data.
-
- >3) Data area containing binary data.
-
- >I'd like to use the CRC method of design outlined by Timothy Budd. For those
- >of you unfamiliar with this method, individual classes are written on cue cards
- >along with class methods and other relavent class information. So, I'd like to
- >break down the above problem in this manner.
-
- >I was thinking of creating the following classes, but don't really know why:
-
- >1) File Selection and control - a class to select the desired file, open the
- >file for reading, close the file and check the file status.
-
- >2) Pointers - a class to handle the pointers.
-
- >3) Text Area - a class for reading and searching the text area.
-
- >4) Data Area - a class for reading the data area and performing calculations.
-
- >Would anyone like to point out why or why not I'd like to break down the
- >problem in this manner? And how I may communicate between classes? For
- >instance, does the File control class want to perform all IO operations or
- >perhaps it would pass the file id to the other classes, so they can read their
- >respective areas. The coding details aren't as important at this point. I'd
- >like to understand the philosophy of file IO. Other references would be
- >appriciated.
-
- > Thanks,
- > Donald G. Plugge
-
- Hello Don,
- I would approach the problem of object design a little differently.
- Rather that deal with the functions to be performed, consider the
- problem domain as an abstract data type and approach it as a
- conceptual model. It's the old "I'm a file processing class and I know
- how to..." approach.
- In your case you may not need that many classes, after all, your
- methods are all interested in contributing to the same general
- problem. You may really need only 1 class with 4 or 5 methods.
- Hope this helps - another Don
-
-